/*
 * packet.h
 *
 *  Created on: Mar 29, 2011
 *      Author: rebirthing
 */

#ifndef PACKET_H_
#define PACKET_H_

#define PT_SSUCOM	0x20//protocol
#define MT_REGISTER_MEMBER_PROFILE	0x01//MsgType
#define MT_REQUEST_RESULT 0x02
#define SIZE 32
typedef struct _msg_reg_mem_profile {
	char name[SIZE];
	char years[SIZE];
	char language[SIZE];
	char prize[SIZE];
	char preferences[SIZE];
	char phoneNumber[SIZE];
} MSG_REGISTER_MEMBER_PROFILE;
typedef struct _msg_req_mem_result {
	char result[SIZE];
} MSG_REQUEST_RESULT;
typedef struct _packet_header {
    unsigned long protocol;
    unsigned long msgType;
    unsigned long dataLength;
    unsigned long reserved;
}  PACKET_HEADER;
typedef union {
    MSG_REGISTER_MEMBER_PROFILE mrmp;
    MSG_REQUEST_RESULT mrmr;
    char dummyMember[1000];
} PACKET_DATA;
typedef struct _msec_packet{
    PACKET_HEADER *header;
    PACKET_DATA *data;
} PACKET;
PACKET *PACKET_new();
PACKET *PACKET_init(PACKET_HEADER *head, PACKET_DATA *data);
PACKET_HEADER *PACKET_HEADER_new();
PACKET_HEADER *PACKET_HEADER_init(unsigned long protocol, unsigned long msgType, unsigned long dataLength);
PACKET_DATA *PACKET_DATA_new();
PACKET_DATA *MSG_REGISTER_MEMBER_PROFILE_init(char *message);
PACKET_DATA *MSG_REQUEST_RESULT_init(char *message);
#endif /* PACKET_H_ */
